﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace CapabilitiesDetector
{
    public partial class DispCapabilities : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DisplayBrowserCapabilities();
        }

        private void DisplayBrowserCapabilities()
        {

          

          
             PanelBasic.Controls.Add(CreateResultLabel("Count",Context.Request.Browser.Capabilities.Count.ToString()  ));
             PanelAdvanced.Controls.Add(CreateResultLabel("Count", ((IDictionary)Context.Request.Browser.Capabilities["WurflCapabilities"]).Count.ToString()));
            foreach (DictionaryEntry key in Context.Request.Browser.Capabilities)
            {
                PanelBasic.Controls.Add(CreateResultLabel(key.Key.ToString(), (key.Value == null) ? string.Empty : key.Value.ToString()));
            }

            foreach (DictionaryEntry key in (IDictionary)Context.Request.Browser.Capabilities["WurflCapabilities"])
            {
                PanelAdvanced.Controls.Add(CreateResultLabel(key.Key.ToString(), (key.Value == null) ? string.Empty : key.Value.ToString()));
            }
            PanelBasic.Visible = true;
            PanelAdvanced.Visible = true;

        }

        private Panel CreateResultLabel(string capability, string value)
        {

            return InputUA.CreateResultLabel(capability, value);  
        }

    }
}